星巡研究院

渗透视角下的C语言

``` #include <sys/ioctl.h> #include <net/route.h> #include <string.h> #include <stdio.h> int main(void) { struct rtentry rt; memset(&rt, 0, sizeof(rt)); /* 清零路由条目,避免垃圾字段 */ /* 写路由示例:SIOCADDRT经ioctl rax=16,需CAP_NET_ADMIN,否则EPERM */ int s = socket(AF_INET, SOCK_DGRAM, 0); if (s < 0) { perror("socket"); return 1; } if (ioctl(s, SIOCADDRT, &rt) < 0) { perror("ioctl SIOCADDRT"); /* 无CAP_NET_ADMIN时EPERM(1) */ } close(s); return 0; } ``` 链路:`ioctl
这是进阶内容

升级理论包获取本册全部章节,从机器本质系统入门